package com.mazaiting.classfile.constant.info;

import com.mazaiting.classfile.ClassReader;
import com.mazaiting.classfile.constant.ConstantPool;

/**
 * 动态方法信息
 *
 * @author mazaiting
 * @since 2021/8/12
 */
public class ConstantInvokeDynamicInfo extends ConstantInfo {
    /**
     * 启动方法属性索引 无符号 u2
     */
    private int bootstrapMethodAttrIndex;
    /**
     * 名称和类型索引 无符号 u2
     */
    private int nameAndTypeIndex;

    public ConstantInvokeDynamicInfo(ConstantPool pool, short tag) {
        super(pool, tag);
    }

    @Override
    public void readInfo(ClassReader reader) {
        this.bootstrapMethodAttrIndex = reader.readU2ToUnsignedShort();
        this.nameAndTypeIndex = reader.readU2ToUnsignedShort();
    }

    @Override
    public String toString() {
        return "ConstantInvokeDynamicInfo{" +
                "bootstrapMethodAttrIndex=" + bootstrapMethodAttrIndex +
                ", nameAndTypeIndex=" + nameAndTypeIndex +
                '}';
    }
}


















